/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow: hidden;
}

/* Main container with responsive height */
.game-container {
    width: 100%;
    height: 450px; /* Default iframe height */
    position: relative;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Responsive height for full browser */
@media (min-height: 500px) {
    .game-container {
        height: 90vh;
    }
}

/* Tooltip styles */
.tooltip {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    max-width: 250px;
    text-align: center;
}

.tooltip.show {
    opacity: 1;
}

.tooltip-content h3 {
    margin-bottom: 4px;
    font-size: 14px;
}

.tooltip-content p {
    font-size: 11px;
    opacity: 0.9;
}

/* Screen management */
.screen {
    width: 100%;
    height: 100%;
    padding: 15px;
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.3s ease;
}

.screen.hidden {
    transform: translateX(100%);
}

/* Character Selection Screen */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    height: 100%;
    align-content: center;
    padding: 20px 0;
}

.character-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 2px solid transparent;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.character-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #4CAF50;
}

.character-card:active {
    transform: translateY(-2px);
}

.character-avatar {
    font-size: 2.5em;
    margin-bottom: 8px;
    animation: bounce 2s infinite;
}

.character-card h3 {
    font-size: 16px;
    margin-bottom: 5px;
    color: #333;
}

.character-card p {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.condition-badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: bold;
    color: white;
}

.condition-badge.osteoporosis { background: #FF6B6B; }
.condition-badge.anaemia { background: #4ECDC4; }
.condition-badge.diabetes { background: #45B7D1; }

/* Game Screen Layout */
#gameScreen {
    display: grid;
    grid-template-rows: auto auto 1fr auto auto;
    gap: 10px;
    height: 100%;
}

/* Character Info Panel */
.character-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.selected-character {
    display: flex;
    align-items: center;
    gap: 8px;
}

.character-emoji {
    font-size: 1.5em;
}

.character-name {
    font-weight: bold;
    font-size: 14px;
}

.health-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.health-bar {
    width: 80px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF6B6B, #4CAF50);
    width: 50%;
    transition: width 0.5s ease;
}

.health-text {
    font-size: 12px;
    font-weight: bold;
}

/* Scenario Card */
.scenario-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.scenario-card h4 {
    font-size: 14px;
    margin-bottom: 5px;
}

.scenario-card p {
    font-size: 12px;
    opacity: 0.9;
}

/* Nutrient Tracker */
.nutrient-tracker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nutrient-bar {
    text-align: center;
}

.nutrient-bar label {
    font-size: 11px;
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
}

.calcium-bar .progress-fill { background: #FF6B6B; }
.iron-bar .progress-fill { background: #4ECDC4; }
.fiber-bar .progress-fill { background: #45B7D1; }

.nutrient-bar span {
    font-size: 10px;
    color: #666;
}

/* Food Marketplace */
.food-marketplace {
    background: white;
    border-radius: 8px;
    padding: 10px;
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.food-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.food-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.food-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #4CAF50;
}

.food-item:active {
    transform: scale(0.95);
}

.food-item.selected {
    background: #e8f5e8;
    border-color: #4CAF50;
}

.food-emoji {
    font-size: 1.8em;
    margin-bottom: 4px;
}

.food-name {
    font-size: 10px;
    font-weight: bold;
    color: #333;
}

.food-nutrients {
    font-size: 8px;
    color: #666;
    margin-top: 2px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    transition: all 0.3s ease;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-tertiary {
    background: #17a2b8;
    color: white;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    max-width: 280px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal:not(.hidden) .modal-content {
    transform: scale(1);
}

.feedback-icon, .victory-animation {
    font-size: 3em;
    margin-bottom: 10px;
    animation: pulse 1s ease-in-out;
}

.modal h3 {
    margin-bottom: 10px;
    color: #333;
}

.modal p {
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
}

/* Animations */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .game-container {
        border-radius: 0;
    }
    
    .character-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .food-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 6px;
    }
    
    .nutrient-tracker {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .action-buttons {
        flex-wrap: wrap;
    }
    
    .btn {
        flex: 1;
        min-width: 80px;
    }
}

/* Touch-friendly sizing */
@media (pointer: coarse) {
    .food-item {
        min-height: 90px;
    }
    
    .character-card {
        min-height: 160px;
    }
    
    .btn {
        min-height: 44px;
        padding: 10px 18px;
    }
}